import os
import sys

env=DefaultEnvironment().Clone()
BIN_DIR=os.environ['BIN_DIR'];

LIBS=['mvvm']+env['LIBS']

env.Program(os.path.join(BIN_DIR, 'demo1'), Glob('demo1/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo2'), Glob('demo2/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo3'), Glob('demo3/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo4'), Glob('demo4/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo5'), Glob('demo5/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo6'), Glob('demo6/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo7'), Glob('demo7/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo8'), Glob('demo8/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo9'), Glob('demo9/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo10'), Glob('demo10/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo11'), Glob('demo11/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo12'), Glob('demo12/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo13'), Glob('demo13/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo14'), Glob('demo14/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo15'), Glob('demo15/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo16'), Glob('demo16/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo17'), Glob('demo17/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo18'), Glob('demo18/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo19'), Glob('demo19/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo20'), Glob('demo20/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo21'), Glob('demo21/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo22'), Glob('demo22/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo23'), Glob('demo23/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo24'), Glob('demo24/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo25'), Glob('demo25/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo26'), Glob('demo26/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo27'), Glob('demo27/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo28'), Glob('demo28/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo29'), Glob('demo29/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo30'), Glob('demo30/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo31'), Glob('demo31/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo32'), Glob('demo32/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo33'), Glob('demo33/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo34'), Glob('demo34/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo35'), Glob('demo35/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo36'), Glob('demo36/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo37'), Glob('demo37/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo38'), Glob('demo38/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo39'), Glob('demo39/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo40'), Glob('demo40/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo41'), Glob('demo41/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo_count_down'), Glob('demo_count_down/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo_file'), Glob('demo_file/*.c'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'demo_conf'), Glob('demo_conf/*.c'),LIBS=LIBS)

if 'WITH_JS' in os.environ and os.environ['WITH_JS'] == 'true':
  env.Program(os.path.join(BIN_DIR, 'jsdemo1'), Glob('jsdemo1/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo2'), Glob('jsdemo2/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo3'), Glob('jsdemo3/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo4'), Glob('jsdemo4/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo5'), Glob('jsdemo5/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo6'), Glob('jsdemo6/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo7'), Glob('jsdemo7/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo8'), Glob('jsdemo8/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo9'), Glob('jsdemo9/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo10'), Glob('jsdemo10/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo11'), Glob('jsdemo11/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo12'), Glob('jsdemo12/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo13'), Glob('jsdemo13/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo14'), Glob('jsdemo14/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo15'), Glob('jsdemo15/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo16'), Glob('jsdemo16/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo17'), Glob('jsdemo17/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo18'), Glob('jsdemo18/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo19'), Glob('jsdemo19/*.c'), LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo35'), Glob('jsdemo35/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo40'), Glob('jsdemo40/*.c'),LIBS=LIBS)
  env.Program(os.path.join(BIN_DIR, 'jsdemo41'), Glob('jsdemo41/*.c'),LIBS=LIBS)

if 'WITH_IOTJS' in os.environ and os.environ['WITH_IOTJS'] == 'true':
  env.Program(os.path.join(BIN_DIR, 'iotjsdemo1'), Glob('iotjsdemo1/*.c'),LIBS=LIBS)

env.Program(os.path.join(BIN_DIR, 'cppdemo1'), Glob('cppdemo1/*.cpp'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'cppdemo2'), Glob('cppdemo2/*.cpp'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'cppdemo3'), Glob('cppdemo3/*.cpp'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'cppdemo4'), Glob('cppdemo4/*.cpp'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'cppdemo5'), Glob('cppdemo5/*.cpp'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'cppdemo6'), Glob('cppdemo6/*.cpp'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'cppdemo7'), Glob('cppdemo7/*.cpp'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'cppdemo8'), Glob('cppdemo8/*.cpp'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'cppdemo9'), Glob('cppdemo9/*.cpp'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'cppdemo10'), Glob('cppdemo10/*.cpp'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'cppdemo11'), Glob('cppdemo11/*.cpp'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'cppdemo12'), Glob('cppdemo12/*.cpp'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'cppdemo13'), Glob('cppdemo13/*.cpp'),LIBS=LIBS)
env.Program(os.path.join(BIN_DIR, 'cppdemo39'), Glob('cppdemo39/*.cpp'),LIBS=LIBS)
